package cn.kailangtu.dataspot.data.context;

import android.graphics.Color;
import android.widget.TextView;

import cn.kailangtu.dataspot.R;

public class KeyboardLockerConfirmContext {
    private  static TextView selectedView;
    private static int normalColor;
    public static TextView getSelectedView()
    {
        return selectedView;
    }

    public static void setSelectedView(TextView newView)
    {

        if(selectedView != null)
        {
            if(selectedView.getTag() != null) {
                if (selectedView.getTag().equals("cancel")) {
                    selectedView.setBackgroundResource(R.drawable.button_selection_normal);
                } else if (selectedView.getTag().equals("save")) {
                    selectedView.setBackgroundResource(R.drawable.button_selection_normal);
                }
            }
            selectedView.setTextColor(normalColor);
        }
        normalColor = newView.getCurrentTextColor();
        selectedView = newView;
        newView.setTextColor(Color.parseColor("#FF0000"));

        if(selectedView.getTag() != null) {
            if (selectedView.getTag().equals("cancel")) {
                selectedView.setBackgroundResource(R.drawable.button_selection_selected);
                selectedView.setTextColor(Color.parseColor("#FFFFFF"));
            } else if (selectedView.getTag().equals("save")) {
                selectedView.setBackgroundResource(R.drawable.button_selection_selected);
                selectedView.setTextColor(Color.parseColor("#FFFFFF"));
            }
        }

    }
}
